<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>GalaxyVenus</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" th:href="@{/frame/css/xadmin.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all"/>
    <link rel="icon" th:href="@{favicon.ico}">
</head>
<body class="login-bg">
<div class="login">
    <div class="login-head">GalaxyVenus管理系统欢迎您！</div>
    <form class="layui-form">
        <input name="username" autocomplete="off" placeholder="用户名" type="text" lay-verify="required"
               class="layui-input">
        <hr class="hr15">
        <input name="password" autocomplete="off" lay-verify="required" placeholder="密码" type="password"
               class="layui-input">
        <hr class="hr15">
        <input value="登录" class="layui-btn layui-btn-normal" lay-submit lay-filter="login" style="width:100%;">
        <hr class="hr20">
    </form>
</div>
<script th:src="@{/layui/layui.js}"></script>
<script>
    layui.use(['form', 'jquery'], function () {
        var form = layui.form, $ = layui.$;
        //监听提交
        form.on('submit(login)', function (data) {
            var index;
            $.ajax({
                type: "post",
                url: "/venus/login",
                data: data.field,
                beforeSend: function () {
                    index = layer.msg('正在登录', {icon: 16, shade: 0.3});
                },
                success: function (r) {
                    layer.close(index);
                    if (r.code == 0) {
                        location.href = '/venus/index';
                    } else {
                        layer.alert(r.msg, {icon: 6});
                    }
                }
            });
            return false;
        });
    });

</script>
</body>
</html>